package com.wanxi.method;

import java.util.Arrays;

public class ForArray {
    public static void main(String[] args) {
        int[] arr = {1,2,4,5,6,5,6,7};
        System.out.println(Arrays.toString(arr));
//        printArr(arr);
    }

    private static void printArr(int[] arr) {
        if (arr == null) {
            System.out.println("null");
            return;
        }
        System.out.print("[");
        for (int i = 0; i < arr.length-1; i++) {
            if (i == arr.length - 1) {
                System.out.print(arr[i]);
            } else {
                System.out.print(arr[i] + ", ");
            }

        }
        System.out.print("]");
    }

}
